<template>
  <div class="question_cell" @click="lookDetail">
    <div class="ask">
      <div class="icon"><img src="@/assets/images/ask.png" alt=""></div>
      <span class="title">{{ info.question }}</span>
    </div>
    <div class="ask answer">
      <div class="icon"></div>
      <div class="van-multi-ellipsis--l2 txt">{{info.introduce}}</div>
    </div>
    <div class="footer">
      <div class="time">{{ showTime(info.questionTime) }}</div>
      <div class="total">
        <img src="@/assets/images/browse.png" alt="">
        <span>{{ info.initReadCnt }}</span>
      </div>
    </div>
  </div>
</template>
<script>
import moment from 'moment'
export default {
  name: "Question",
  props: {
    info: {
      type: Object,
      default: function () {
        return {};
      },
    },
  },
  data() {
    return {};
  },
  methods: {
    // 查看详情
    lookDetail() {
      let id = this.info.id;
      this.$router.push({
        path: `/questions/${id}`,
      });
    },

    // 格式化时间
    showTime(str) {
      if (!str) {
        return ''
      }
      let o = moment(str).format('YYYY-MM-DD')
      return o;
    }

  },
};
</script>
<style lang="less" scoped>
@import "./index.less";
</style>